package cn.edu.hpu.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import cn.edu.hpu.dao.UserDao;
import cn.edu.hpu.pojo.User;

public class UserService {
	private UserDao userDao;
	public User findA(User user){
		return  userDao.findByUnique("email", user.getEmail());
		/*if (u != null && u.getPassword().equals(user.getPassword())) {
			return u;
		} else {
			return null;
		}*/
	}
	public List<User> findAll(){
		List<User> ulist = userDao.findAll();
		if (ulist.isEmpty()) {
			return null;
		} else {
			return ulist;
		}
	}
	public void save(User user){
		userDao.save(user);
	}
	public User findAUser(String id){
		return userDao.get(id);
	}
	
	@Autowired
	public void setUserDao(UserDao userDao) {
		this.userDao = userDao;
	}
	
}
